mydata <- read.csv2("Grades.csv")
head(mydata)
##   ID Exam Writing Lectures
## 1  1   64      90        3
## 2  2   90     120        4
## 3  3   15      33        1
## 4  4   94      90        4
## 5  5   51      45        2
## 6  6   62     100        2

Description of variables:

library(ggplot2)
ggplot(mydata, aes(x = Writing, y = Exam)) +
  geom_point(size = 2, alpha = 0.7) +
  labs(
    title = "Exam Performance and Writing Time",
    subtitle = "Research Methods and Techniques exam",
    x = "Time spent writing the exam (minutes)",
    y = "Exam score (%)"
  ) +
  theme_minimal()

library(ggplot2)
library(ggExtra)

p <- ggplot(mydata, aes(x = Writing, y = Exam)) +
  geom_point(size = 2, alpha = 0.7) +
  labs(
    title = "Exam Performance and Writing Time",
    subtitle = "Research Methods and Techniques exam",
    x = "Time spent writing the exam (minutes)",
    y = "Exam score (%)"
  ) +
  theme_minimal()

ggMarginal(p, type = "boxplot", fill = "grey80")

cov(mydata$Exam, mydata$Writing) 
## [1] 392.9495
var(mydata$Exam) 
## [1] 417.2868
var(mydata$Writing)
## [1] 652.0266
cor(mydata$Exam, mydata$Writing,
    method = "pearson") 
## [1] 0.7533325
cor.test(mydata$Exam, mydata$Writing,
    method = "pearson") 
## 
##  Pearson's product-moment correlation
## 
## data:  mydata$Exam and mydata$Writing
## t = 7.7692, df = 46, p-value = 6.487e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.5969802 0.8545521
## sample estimates:
##       cor 
## 0.7533325
library(ggplot2)
ggplot(mydata, aes(x = Lectures, y = Exam)) +
  geom_point(size = 2, alpha = 0.7) +
  labs(
    title = "Exam Performance and Lecture Attendance",
    subtitle = "Research Methods and Techniques exam",
    x = "Lecture attendance (1 = never, 4 = always)",
    y = "Exam score (%)"
  ) +
  scale_x_continuous(breaks = 1:4) +
  theme_minimal()

cor(mydata$Exam, mydata$Lectures,
    method = "spearman") 
## [1] 0.836497
cor.test(mydata$Exam, mydata$Lectures,
    method = "spearman",
    exact = FALSE) 
## 
##  Spearman's rank correlation rho
## 
## data:  mydata$Exam and mydata$Lectures
## S = 3012.4, p-value = 1.333e-13
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##      rho 
## 0.836497